export interface IRouteChild {
  path: string
  component: string
  name?: string,
  wrappers?: Array<string>
}
export interface IRoute {
  path: string
  component?: string
  name?: string // 兼容此写法
  icon?: string
  // 新页面打开 - 可选参数 - ？
  target?: string
  // 不展示顶栏
  headerRender?: boolean,
  // 不展示页脚
  footerRender?: boolean,
  // 不展示菜单
  menuRender?: boolean,
  // 不展示菜单顶栏
  menuHeaderRender?: boolean,
  // 权限配置，需要与 plugin-access 插件配合使用
  access?: string,
  // 隐藏子菜单
  hideChildrenInMenu?: boolean,
  // 隐藏自己和子菜单
  hideInMenu?: boolean,
  // 在面包屑中隐藏
  hideInBreadcrumb?: boolean,
  // 子项往上提，仍旧展示,
  flatMenu?: boolean,
  routes?: Array<IRouteChild>,
  redirect?: any,
  exact?: boolean,
  wrappers?: Array<string>
}

export const routes: Array<IRoute> = [
  {
    path: '/',
    exact: true,
    redirect: '/home'
  },
  {
    path: '/home',
    wrappers: [ '@/wrappers/auth' ],
    name: '首页',
    component: '@/pages/home/index',
    icon: 'HomeOutlined'
  },
  {
    path: '/login',
    component: '@/pages/login/index',
    headerRender: false,
    footerRender: false,
    menuRender: false
  },
  {
    path: '/banner',
    name: '轮播图管理',
    wrappers: [ '@/wrappers/role' ],
    icon: 'PictureOutlined',
    routes: [
      {
        path: '/banner/list',
        name: '轮播图列表',
        wrappers: [ '@/wrappers/role' ],
        component: '@/pages/banner-manager/list'
      },
      {
        path: '/banner/add',
        // name: '添加轮播图',
        component: '@/pages/banner-manager/add'
      }
    ]
  },
  {
    path: '/pro',
    name: '产品管理',
    icon: 'PictureOutlined',
    // 子路由存在时，不要加component，加了之后子路由会失效 ---- 页面pages
    // component: '@/pages/pro-manager/index'
    // 如果非要加component,在src/layouts下创建一个布局文件，引入布局文件即可
    // component: '@/layouts/index',
    routes: [
      {
        path: '/pro/list',
        name: '产品列表',
        wrappers: [ '@/wrappers/auth' ],
        component: '@/pages/pro-manager/list'
      },
      {
        path: '/pro/recommend',
        name: '推荐列表',
        wrappers: [ '@/wrappers/auth' ],
        component: '@/pages/pro-manager/recommend'
      },
      {
        path: '/pro/seckill',
        name: '秒杀列表',
        component: '@/pages/pro-manager/seckill'
      }
    ]
  },
  {
    path: '/user',
    name: '用户管理',
    icon: 'PictureOutlined',
    routes: [
      {
        path: '/user/list',
        name: '用户列表',
        component: '@/pages/home/index',
      },
      {
        path: '/user/adminlist',
        name: '管理员列表',
        component: '@/pages/home/index',
      }
    ]
  },
  {
    path: '/form',
    name: '表单管理',
    icon: 'PictureOutlined',
    routes: [
      {
        path: '/form/braft',
        name: '富文本编辑器',
        component: '@/pages/form-manager/braft',
      }
    ]
  },
  {
    path: '/data',
    name: '数据可视化',
    icon: 'PictureOutlined',
    routes: [
      {
        path: '/data/echarts',
        name: 'echarts数据可视化',
        component: '@/pages/data-manager/echarts',
      },
      {
        path: '/data/test',
        name: 'test',
        component: '@/pages/data-manager/Test',
      }
    ]
  }
]
